package me.tomato3017.plugins.epicmusic.region;

import java.util.ArrayList;
import java.util.List;
import me.tomato3017.plugins.epicmusic.EpicMusic;
import me.tomato3017.plugins.epicmusic.audio.AmbientMusicData;
import me.tomato3017.plugins.epicmusic.audio.MusicData;

/**
 *
 * @author Anthony Kirksey <Anthony.Kirksey@gmail.com>
 */
public class RegionData {
    private List<MusicData> musicPlaylist;
    private AmbientMusicData ambientMusic;
    private String regionName;
    private int soundEffectDistance;
    private int soundEffectDistSQRT;

    public RegionData(List<MusicData> musicPlaylist, AmbientMusicData ambientMusic, String regionName) {
        this.musicPlaylist = musicPlaylist;
        this.ambientMusic = ambientMusic;
        this.regionName = regionName; 
    }

    public RegionData(List<MusicData> musicPlaylist, AmbientMusicData ambientMusic, String regionName, int soundEffectDistance) {
        this.musicPlaylist = musicPlaylist;
        this.ambientMusic = ambientMusic;
        this.regionName = regionName;
        this.soundEffectDistance = soundEffectDistance;
    }

    
    public RegionData() {
        this.musicPlaylist = new ArrayList<MusicData>();
        this.regionName = "Unused";
        this.soundEffectDistance = EpicMusic.getDefaultSoundEffectDistance();
        
    }


    @Override
    public String toString() {
        return regionName;
    }

    public AmbientMusicData getAmbientMusic() {
        return ambientMusic;
    }

    public void setAmbientMusic(AmbientMusicData ambientMusic) {
        this.ambientMusic = ambientMusic;
    }

    public List<MusicData> getMusicPlaylist() {
        return musicPlaylist;
    }

    public void setMusicPlaylist(List<MusicData> musicPlaylist) {
        this.musicPlaylist = musicPlaylist;
    }

    public String getRegionName() {
        return regionName;
    }

    public void setRegionName(String regionName) {
        this.regionName = regionName;
    }   
    
    public void addMusic(MusicData music){
        if(music != null){
            musicPlaylist.add(music);
        }
    }

    public int getSoundEffectDistance() {
        return soundEffectDistance;
    }

    public void setSoundEffectDistance(int soundEffectDistance) {
        this.soundEffectDistance = soundEffectDistance;
        this.soundEffectDistSQRT = (int) Math.sqrt(soundEffectDistance);
    }
    
    public int getSoundEffectDistanceSQRT(){
        return this.soundEffectDistSQRT;
    }
    
}
